package lab03.test05;

import java.io.*;

/**
 * Created by V555 on 2017/12/19.
 */
public class Test {
    public static void main(String[] args) {
        BufferedWriter writer=null;
        BufferedReader reader=null;
        String s="";
        try {
            writer=new BufferedWriter(new FileWriter("F:\\123.txt"));
            writer.write("qert");
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {
            reader=new BufferedReader(new FileReader("F:\\123.txt"));
            while (true){
                s=reader.readLine();
                if (reader.readLine()==null){
                    break;
                }
            }
            System.out.println("加密后输出为"+s);
            String[] s1=new String[s.length()];
            StringBuffer str=new StringBuffer();
            for (int i=0;i<s.length();i++){
                s1[i]=new String(String.valueOf((char)(s.charAt(i)-1)));
                str.append(s1[i]);
            }
            System.out.println(str.toString());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
